package com.api.shopapi.mapper;

import com.api.shopapi.entity.QZXuetangyi;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface QZXuetangyiMapper {

    @Insert("insert into qz_xuetangyi (QZXuetangyiCode," +
            "Signature," +
            "Timestamp," +
            "Randomnumber," +
            "Reservedcode," +
            "Aimstatus," +
            "Code," +
            "CreateTime," +
            "Devicesn," +
            "Foodstatus," +
            "HctResult," +
            "Openid," +
            "Result," +
            "TestTime," +
            "Unit," +
            "UserCode) values " +
            "(#{qzXuetangyi.QZXuetangyiCode}," +
            "#{qzXuetangyi.Signature}," +
            "#{qzXuetangyi.Timestamp}," +
            "#{qzXuetangyi.Randomnumber}," +
            "#{qzXuetangyi.Reservedcode}," +
            "#{qzXuetangyi.Aimstatus}," +
            "#{qzXuetangyi.Code}," +
            "#{qzXuetangyi.CreateTime}," +
            "#{qzXuetangyi.Devicesn}," +
            "#{qzXuetangyi.Foodstatus}," +
            "#{qzXuetangyi.HctResult}," +
            "#{qzXuetangyi.Openid}," +
            "#{qzXuetangyi.Result}," +
            "#{qzXuetangyi.TestTime}," +
            "#{qzXuetangyi.Unit}," +
            "#{qzXuetangyi.UserCode})")
    int insert(@Param("qzXuetangyi") QZXuetangyi qzXuetangyi);


    @Select("select * from qz_xuetangyi where Devicesn=#{sn} order by TestTime desc")
    List<QZXuetangyi> getPageByDevicesn(@Param("sn") String sn);
}
